import request from '@/utils/request';
import type { Book, BookQueryParams, PageResult } from '@/types/book';
import type { ApiResponse } from '@/types/user';

// 图书列表查询
export const getBookList = (params: BookQueryParams): Promise<ApiResponse<PageResult<Book>>> => {
  return request.get('/books', { params });
};

// 获取图书分类
export const getBookCategories = (): Promise<ApiResponse<string[]>> => {
  return request.get('/books/categories');
};

// 图书详情
export const getBookDetail = (bookId: number): Promise<ApiResponse<Book>> => {
  return request.get(`/books/${bookId}`);
};
